package com.project.service;

import com.project.dao.StudentInfoMapper;
import com.project.entity.StudentInfo;
import com.project.myBeans.StudentInfoDetail;
import com.project.service.base.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional(rollbackFor = {Exception.class})
@Service
public class StudentInfoServiceImpl extends BaseService implements StudentInfoService {

    @Autowired
    StudentInfoMapper studentInfoMapper;

    @Override
    public void add(StudentInfo studentInfo) {
        studentInfoMapper.insertSelective(studentInfo);
    }

    @Override
    public StudentInfo findByUserId(Integer userid) {
        return studentInfoMapper.selectByUserId(userid);
    }

    @Override
    public StudentInfo findById(Integer id) {
        return studentInfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public StudentInfoDetail findDetailById(Integer Id) {
        return studentInfoMapper.selectDetailByPrimaryKey(Id);
    }
}
